package com.bafa.front.presentationbeans;

import com.bafa.objects.season.Division;
import com.bafa.objects.season.Season;

public class SeasonBean implements Comparable {

	private String name;
	private int id;
	private int year;
	private boolean league;
	private LeagueListBean leagueList = new LeagueListBean();
	private RoundListBean roundList = null; 
	private final static String[] seasons = {"Winter","Spring","Summer","Autumn"};
	
	public SeasonBean(){
		
	}
	
	public SeasonBean(String name, int id, int year) {
		super();
		// TODO Auto-generated constructor stub
		this.name = name;
		this.id = id;
		this.year = year;
	}

	public SeasonBean(Season season) {
		super();
		// TODO Auto-generated constructor stub
		this.name = season.getName();
		this.id = season.getId();
		this.year = season.getYear();
		this.league = season.isLeague();
		leagueList = new LeagueListBean(season.getId(),(Division[])season.getDivisions().values().toArray(new Division[season.getDivisions().values().size()]));
	}
	
	public int compareTo(Object arg0) {
		SeasonBean bean = (SeasonBean)arg0;
		if(this.year!=bean.getYear()){
			return bean.getYear()-this.year;
		}else{
			return bean.getId() - this.id;
		}
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public LeagueListBean getLeagueList() {
		return leagueList;
	}

	public void setLeagueList(LeagueListBean leagueList) {
		this.leagueList = leagueList;
	}

	public boolean isLeague() {
		return league;
	}

	public void setLeague(boolean league) {
		this.league = league;
	}

}
